﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/SiteAdmin.Master" Inherits="System.Web.Mvc.ViewPage<Beeldbankmvc.ViewModels.ReportPageViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">Statistiek overzicht</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent"
    runat="server">
    <script language="javascript" type="text/javascript">
        $(function ()
        {
            $("#MoveRight,#MoveLeft").click(function (event)
            {
                var id = $(event.target).attr("id");
                var selectFrom = id == "MoveRight" ? "#AllCollectionItems" : "#SelectedCollectionItems";
                var moveTo = id == "MoveRight" ? "#SelectedCollectionItems" : "#AllCollectionItems";

                var selectedItems = $(selectFrom + " :selected").toArray();
                $(moveTo).append(selectedItems);
                selectedItems.remove;
            });
        });

        $(function ()
        {
            $("#submit").click(function (event)
            {
                $("#SelectedCollectionItems *").attr("selected", "selected");
            });
        });

        /* Dutch (UTF-8) initialisation for the jQuery UI date picker plugin. */
        /* Written by Mathias Bynens <http://mathiasbynens.be/> */
        jQuery(function($)
        {
            $.datepicker.regional['nl'] =
            {
                closeText: 'Sluiten',
                prevText: '←',
                nextText: '→',
                currentText: 'Vandaag',
                monthNames: ['Januari', 'Februari', 'Maart', 'April', 'Mei', 'Juni', 'Juli', 'Augustus', 'September', 'Oktober', 'November', 'December'],
                monthNamesShort: ['jan', 'feb', 'maa', 'apr', 'mei', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
                dayNames: ['Zondag', 'Maandag', 'Dinsdag', 'Woensdag', 'Donderdag', 'Vrijdag', 'Zaterdag'],
                dayNamesShort: ['zon', 'maa', 'din', 'woe', 'don', 'vri', 'zat'],
                dayNamesMin: ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'],
                weekHeader: 'Wk',
                dateFormat: 'dd-mm-yy',
                firstDay: 1,
                isRTL: false,
                showMonthAfterYear: false,
                yearSuffix: ''
            };
            $.datepicker.setDefaults($.datepicker.regional['nl']);
        });

        $(document).ready(function ()
        {
            var selected = null;

            $('#Report_From_Date').datepicker({ beforeShowDay: function (date)
            {
                if (selected != null && date.getTime() > selected.getTime() && (date.getTime() - selected.getTime()) < 12 * 24 * 3600 * 1000)
                {
                    return [true, "highlighted"];
                }
                return [true, ""];
            }
        });
        
            $('#Report_To_Date').datepicker({ beforeShowDay: function (date)
            {
                if (selected != null && date.getTime() > selected.getTime() && (date.getTime() - selected.getTime()) < 12 * 24 * 3600 * 1000)
                {
                    return [true, "highlighted"];
                }
                return [true, ""];
            }
        });


            $("#Report_From_Date").datepicker('option', 'onSelect', function () {
            });

            $("#Report_To_Date").datepicker('option', 'onSelect', function () {
            });

            $('#Report_From_Date').datepicker('setDate', new Date(<%: Model.fromDate.Year %>, <%: Model.fromDate.Month - 1 %>, <%: Model.fromDate.Day %>));
            $('#Report_To_Date').datepicker('setDate', new Date(<%: Model.toDate.Year %>, <%: Model.toDate.Month - 1 %>, <%: Model.toDate.Day %>));
        }); 
    </script>
    <% Html.RenderAction("AdminMenu", "Miscellaneous"); %>
    <h2>Statistiek overzicht</h2>
    <div id="register">
        <% using (Html.BeginForm())
           { %>
             <table>
                <tr>
                    <td>
                        <fieldset>
                            Van:
                            <input id="Report_From_Date" name="Report.From_Date" type="text" style="width: 85px" />
                            Tot:
                            <input id="Report_To_Date" name="Report.To_Date" type="text" style="width: 85px" />
                            <input id="submit" type="submit" value="Filter" class="button" />
                        </fieldset>
                    </td>
                    <td style="width:100px">
                    </td>
                    <td style="vertical-align:middle">
                        <h4><%:Html.ActionLink("Vorige maand", "Index", "Report", new {standardReport= "PrevMonth"}, null)%></h4>
                        <h4><%:Html.ActionLink("Vorig jaar", "Index", "Report", new {standardReport= "PrevYear"}, null)%></h4>
                    </td>
                    <td style="vertical-align:middle">
                        <h4><%:Html.ActionLink("Deze maand", "Index", "Report", new {standardReport= "CurMonth"}, null)%></h4>
                        <h4><%:Html.ActionLink("Dit jaar", "Index", "Report", new {standardReport= "CurYear"}, null)%></h4>
                    </td>
                </tr>
            </table>
            <div class="reports" style="width: 646px;">
                <div style="width: 200px;">
                    <% Html.RenderPartial("NumberOfSearches", Model.numberOfSearchesModel); %>
                </div>
                <div style="float: left; display: inline-block; width: 220px;">
                    <% Html.RenderPartial("MostWanted", Model.mostWantedModels); %></div>
                <div style="float: left; display: inline-block; width: 200px;">
                    <% Html.RenderPartial("RecentlyAddedMedia", Model.recentlyAddedMediaModels); %>
                </div>
                <div style="float: left; display: inline-block; width: 180px;">
                    <% Html.RenderPartial("Numbers", Model.collectionNumbersModels); %></div>
                <div style="display: inline-block; width: 600px;">
                    <% Html.RenderPartial("Orders", Model.orderModels); %>
                </div>
            </div>
        <% } %>
    </div>
</asp:Content>
